<template>
  <div>
    <el-dialog
      :title="dialog_main_title"
      v-dialogDrag
      :visible.sync="edit_excel_flag"
      width="70%"
      append-to-body
      :before-close="handleClose"
      :show-close="false">
      <div style="width: 100%;position: relative;">
        <!-- fullScreenLoading -->
        <v-loading v-if="edit_loading"></v-loading>
        <!--table-->
        <el-table
          :key='tableKey'
          :data="table_data" border highlight-current-row fit
          element-loading-text="数据越多上传时间越久"
          style="width: 100%;min-height: 100px;height: auto;max-height: 300px;overflow-x: auto;overflow-y: auto;">
          <el-table-column v-for='item of table_header' :prop="item" :label="item" :key='item' style="width: auto;">
          </el-table-column>
        </el-table>
      </div>
      <el-row style="margin: 10px 0">
        <el-col :span="20"><span style="color: #fff">'</span></el-col>
        <el-col :span="4" style="display: flex;justify-content: flex-start;align-items: center;">
          <el-button @click="handleClose">取 消</el-button>
          <el-button type="primary" :disabled='confirm_save_disabled' @click="confirmSave">确认导入</el-button>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>

<script type="text/javascript">
  import Loading from '@/components/loading/loading'
  export default {
    name: 'edit',
    props: ['edit_excel_flag', 'dialog_main_title', 'table_data', 'table_header', 'edit_loading', 'confirm_save_disabled'],
    components: {
      'v-loading': Loading
    },
    data() {
      return {
        tableKey: 0
      }
    },
    created() {
    },
    methods: {
      confirmSave() {
        this.$emit('edit-confirm-Two', this.table_data)
      },
      handleClose() {
        this.$emit('edit-close-Two', false)
      }
    }
  }
</script>

<style type="text/css" scoped>
  .add-edit-table th{
    color:#878d99
  }
  .add-edit-table th,td{
    border: 1px solid #e6ebf5;
    text-align: center;
  }
  .el-table::before {
    left: 0;
    bottom: 0;
    width: 100%;
    height: auto;
  }
</style>
